/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "DIA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Dia.findAll", query = "SELECT d FROM Dia d"),
    @NamedQuery(name = "Dia.findByDiaCod", query = "SELECT d FROM Dia d WHERE d.diaCod = :diaCod"),
    @NamedQuery(name = "Dia.findByDiaNom", query = "SELECT d FROM Dia d WHERE d.diaNom = :diaNom"),
    @NamedQuery(name = "Dia.findByDiaHora", query = "SELECT d FROM Dia d WHERE d.diaHora = :diaHora")})
public class Dia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "DIA_COD")
    private Integer diaCod;
    @Basic(optional = false)
    @Column(name = "DIA_NOM")
    private String diaNom;
    @Column(name = "DIA_HORA")
    private String diaHora;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dia", fetch = FetchType.LAZY)
    private List<Horario> horarioList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "dia", fetch = FetchType.LAZY)
    private List<HorarioPersonal> horarioPersonalList;

    public Dia() {
    }

    public Dia(Integer diaCod) {
        this.diaCod = diaCod;
    }

    public Dia(Integer diaCod, String diaNom) {
        this.diaCod = diaCod;
        this.diaNom = diaNom;
    }

    public Integer getDiaCod() {
        return diaCod;
    }

    public void setDiaCod(Integer diaCod) {
        this.diaCod = diaCod;
    }

    public String getDiaNom() {
        return diaNom;
    }

    public void setDiaNom(String diaNom) {
        this.diaNom = diaNom;
    }

    public String getDiaHora() {
        return diaHora;
    }

    public void setDiaHora(String diaHora) {
        this.diaHora = diaHora;
    }

    @XmlTransient
    public List<Horario> getHorarioList() {
        return horarioList;
    }

    public void setHorarioList(List<Horario> horarioList) {
        this.horarioList = horarioList;
    }

    @XmlTransient
    public List<HorarioPersonal> getHorarioPersonalList() {
        return horarioPersonalList;
    }

    public void setHorarioPersonalList(List<HorarioPersonal> horarioPersonalList) {
        this.horarioPersonalList = horarioPersonalList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (diaCod != null ? diaCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Dia)) {
            return false;
        }
        Dia other = (Dia) object;
        if ((this.diaCod == null && other.diaCod != null) || (this.diaCod != null && !this.diaCod.equals(other.diaCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.Dia[ diaCod=" + diaCod + " ]";
    }
    
}
